home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7756 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.clark.net!not-for-mail
  2. From: gusty@clark.net (Harlan Messinger)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Pointer to members
  5. Date: 14 Feb 1996 06:31:33 GMT
  6. Organization: Clark Internet Services, Inc., Ellicott City, MD USA
  7. Message-ID: <4frvk5$n@clarknet.clark.net>
  8. References: <4fqg56$cfl@gina.zfn.uni-bremen.de>
  9. NNTP-Posting-Host: explorer.clark.net
  10. Mime-Version: 1.0
  11. Content-Type: TEXT/PLAIN; charset=ISO-8859-1
  12. Content-Transfer-Encoding: 8bit
  13.  
  14. Holger Burde (j03k@alf.zfn.uni-bremen.de) wrote:
  15. : Hi,
  16. : I am writing a drawing Application with C++ and the Motif Toolkit.
  17. : I saw that the 'right' way to use Classmembers as callbackproc's is
  18. : to declare them static (static members have ordinary Functions Pointers).
  19. : Is this the only way ?????
  20. : Is there any way to get normal member fuctions accepted (cast  from
  21. : member function to Functions Pointer without compiler feature ...) ??
  22.  
  23. A pointer to a non-static member function is like an offset: it only has 
  24. meaning when combined with a class object relative to which the pointer 
  25. points. 
  26.  
  27. The routine that wants to call the callback procedure expects to be able 
  28. to call the procedure directly. It isn't expecting to have to match a 
  29. pointer-to-member up with an appropriate object. It may not even have 
  30. _access_ to an object of the class.
  31.  
  32. Except for scope, a static member function is pretty much like a 
  33. non-member function. Its address points directly to it rather than being 
  34. an offset from some other point in the class or its offsprung objects.
  35.